# Maintainer: João Guerra <joca.bt@gmail.com>

_pyname=Pygments
pkgbase="python-pygments"
pkgname=("python-pygments")
pkgver=2.7.1
pkgrel=1
pkgdesc="A syntax highlighting engine written in Python"
arch=("i686" "x86_64")
url="http://pygments.org/"
license=('BSD')
depends=("python")
makedepends=("python-setuptools")
provides=("python3-pygments")
conflicts=("python3-pygments")
replaces=("python3-pygments")
source=("https://pypi.python.org/packages/source/P/Pygments/Pygments-${pkgver}.tar.gz")
noextract=("Pygments-${pkgver}.tar.gz")
sha256sums=('926c3f319eda178d1bd90851e4317e6d8cdb5e292a3386aac9bd75eca29cf9c7')

prepare () {
  # workaround for symlink issue
  tar -xf ${_pyname}-${pkgver}.tar.gz || true
  cp ${_pyname}-${pkgver}/scripts/debug_lexer.py \
    ${_pyname}-${pkgver}/scripts/find_error.py

}

package () {
  cd "${_pyname}-${pkgver}"

  /usr/bin/python setup.py install --root="${pkgdir}" -O1
  install -Dm644 external/pygments.bashcomp "${pkgdir}/usr/share/bash-completion/completions/pygmentize"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
